package com.dbq.fast.business.product.ui;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.dbq.fast.R;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 */

public class ChooseCoupons extends LinearLayout {

    @BindView(R.id.title)
    TextView title;

    @BindView(R.id.tv_a_few_fold)
    TextView tvFold;

    @BindView(R.id.tv_a_few_fold_tip)
    TextView tvFoldTip;

    public static final int NO_VALIED_COUPONS = 001;
    public static final int VALIED_COUPONS = 002;
    public static final int CHOOSE_RESULT = 003;

    public ChooseCoupons(Context context) {
        this(context, null);
    }

    public ChooseCoupons(Context context, @Nullable AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public ChooseCoupons(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init() {
        View rooView = LayoutInflater.from(getContext()).inflate(R.layout.view_choose_coupons, null);
        ButterKnife.bind(this, rooView);
        this.addView(rooView);
    }

    public void setStatus(int status) {
        if (status == NO_VALIED_COUPONS) {
            tvFold.setTextColor(getResources().getColor(R.color.font_normal));
            tvFoldTip.setTextColor(getResources().getColor(R.color.font_normal));
        } else if (status == VALIED_COUPONS) {
            tvFold.setTextColor(getResources().getColor(R.color.coupons_color));
            tvFoldTip.setTextColor(getResources().getColor(R.color.font_normal));
        } else if (status == CHOOSE_RESULT) {
            tvFold.setTextColor(getResources().getColor(R.color.coupons_color));
            tvFoldTip.setTextColor(getResources().getColor(R.color.coupons_color));
        }
    }

    public void setAFewFold(String t) {
        tvFold.setText(t);
    }

    public void setTip(String t) {
        tvFoldTip.setText(t);
    }
}
